/**********************************************************************
	*	@author Li Suyong
	*  @version 1.0
	*  @date 2011/10/12
***********************************************************************/

#include "Test.h"

/** define TestApplicationFactory's static variable.*/
//template<> TestApp::TestApplicationFactory * CommonClasses::Singleton
//	<TestApp::TestApplicationFactory>::mSingleton = new TestApp::TestApplicationFactory;

namespace TestApp
{
	//---------------------------------------------------------------------
	//TestApplication
	//---------------------------------------------------------------------
	void TestApplication::execute()
	{
		execute_impl();
	}
	//---------------------------------------------------------------------
	//TestApplicationFactory
	//---------------------------------------------------------------------
	TestApplicationPtr TestApplicationFactory::getTestApp(TestKind testKind)
	{
		switch (testKind)
		{
		case CONSEQUENT_FUNCTION_CALLING:
			return  TestApplicationPtr(new TestApplication_ConsequentFunctionCalling);
		}

		return TestApplicationPtr(NULL);
	}
	//---------------------------------------------------------------------
	//TestApplication_ConsequentFunctionCalling 
	//---------------------------------------------------------------------
	/** Test factor. */
#define TF_TEST_COUNT 1000000000  // 1000000000
	
	void TestApplication_ConsequentFunctionCalling::execute_impl()
	{
		int it, jt, sum;
		it = jt = sum = 0;

		for (; it < TF_TEST_COUNT; ++it)
		{
			for (; jt < TF_TEST_COUNT; ++jt)
			{
				sum += it * jt;
			}
		}
	}
}